<script type="text/javascript">
	$(function() {
		$("#tree").treeview({
			collapsed: true,
			animated: "medium",
			control: "#sidetreecontrol",
			persist: "cookie"
		});
	})
</script>
<div id="sidetreecontrol"><a href="?#">Collapse All</a> | <a href="?#">Expand All</a></div>
<?php 
if (!isset($model)) {
	$model = ucfirst(Inflector::Singularize($this->params['controller']));
}
if(!empty($treelist)) {
	echo $tree->generate($treelist, array('id' => 'tree', 'model' => $model)); 
}
?>